<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>任务评价列表 - 威客任务平台</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <div th:replace="~{fragments/header :: header}"></div>
    
    <div class="container mt-4">
        <div class="d-flex justify-content-between align-items-center mb-4">
            <h2>任务评价列表</h2>
            <a th:href="@{/employer/tasks}" class="btn btn-primary">返回任务列表</a>
        </div>
        
        <div class="card mb-4">
            <div class="card-body">
                <h5>任务信息</h5>
                <p><strong>任务标题:</strong> <span th:text="${task.title}">任务标题</span></p>
            </div>
        </div>
        
        <div th:if="${reviews.empty}" class="alert alert-info">
            暂无评价
        </div>
        
        <div th:if="${!reviews.empty}">
            <div class="row">
                <div class="col-12" th:each="review : ${reviews}">
                    <div class="card mb-3">
                        <div class="card-body">
                            <div class="d-flex justify-content-between">
                                <h5 class="card-title">
                                    <span th:each="i : ${#numbers.sequence(1, 5)}">
                                        <span th:if="${i <= review.rating}" class="text-warning">★</span>
                                        <span th:unless="${i <= review.rating}" class="text-muted">☆</span>
                                    </span>
                                </h5>
                                <div>
                                    <a th:href="@{/task-reviews/edit/{reviewId}(reviewId=${review.reviewId})}" class="btn btn-sm btn-warning">编辑</a>
                                    <form th:action="@{/task-reviews/delete/{reviewId}(reviewId=${review.reviewId})}" method="post" style="display: inline;">
                                        <button type="submit" class="btn btn-sm btn-danger" 
                                                onclick="return confirm('确定要删除这个评价吗？')">删除</button>
                                    </form>
                                </div>
                            </div>
                            <p class="card-text" th:text="${review.content}">评价内容</p>
                            <p class="card-text">
                                <small class="text-muted">
                                    评价时间: <span th:text="${#temporals.format(review.reviewTime, 'yyyy-MM-dd HH:mm')}">评价时间</span>
                                </small>
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <div th:replace="~{fragments/footer :: footer}"></div>
    
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>